let http = require("http");
let querystring = require("querystring");
let postData = {"lastid":0,"page":0,"number":20,"oauth_token":"0tVroqQvswWAynRvKos6P1WCNU6YSezw"};
let query_string = querystring.stringify(postData);
//lastid=0&&page=0
const options = {
    hostname:"tt.linweiqin.com",
    port:80,
    method:"POST",
    path:"/api/tt/getArticles",
    headers:{
        'Accept': 'application/json, text/plain, */*',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'zh-CN,zh;q=0.9',
        'Connection': 'keep-alive',
        'Content-Length': query_string.length,
        'Content-Type': 'application/json;charset=UTF-8',
        'Host': 'tt.linweiqin.com',
        'Origin': 'http://linweiqin.cn',
        'Referer':' http://linweiqin.cn/tt/',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36'
    }
}
//返回的数据
let responseData = "";
let request = http.request(options,(res)=>{
    res.on("data",(data)=>{
        console.log(data);
        responseData+=data;
    })
    res.on("error",function(err){
        console.log(err);
    })
    res.on("end",function(){
        //console.log(responseData);
        JSON.parse(responseData).articles.map((v,i)=>{
            console.log(v.nid);
        })
        //console.log(responseData);
        console.log("数据已经加载完毕");
    })
})
request.wirte(query_string);
request.end();